
from src.vobjects.item import Item

class Plugin:

    def __init__(self, id, name, query_description, params):
        self.id = id
        self.name = name
        self.query_description = query_description
        self.params = params

    @staticmethod
    def from_json(js):
        return Plugin(
            id                  = js['id'],
            name                = js['name'],
            query_description   = js['query_description'],
            params              = js['params']
        )
    
    def to_item(self):
        return Item(title=self.name, parent=self)

